
// 基于template/src/views/{{appModules}}/{{pages@DEDATAVIEW}}/{{spinalCase page.codeName}}-hook.ts.hbs生成
import { QXEvent } from 'qx-util';
import {
	DataViewActionType,
	DataViewController,
	IDataViewAbility,
	IDataViewControllerParams,
	IParam,
	IViewEvent,
} from '@/core';
import {
	useDataViewProps,
	useDataViewBasic,
	useDataViewControllerParams,
    useDataViewAction,
} from '@/hooks/view/use-data-view';
import { model } from "./ibizbook-test-cl-data-view-model";

/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...useDataViewProps()
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...useDataViewBasic(model, props)
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
        ...useDataViewAction(controller)
    }
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<DataViewActionType, IDataViewAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<IViewEvent<DataViewActionType, IDataViewAbility>>
) {
	const params: IDataViewControllerParams<
		DataViewActionType,
		IDataViewAbility
	> = useDataViewControllerParams(model, props, evt);
	return new DataViewController(params);
}